#ifndef CVRENDERINGDEVICE_H_INCLUDED
#define CVRENDERINGDEVICE_H_INCLUDED

//predecl
namespace cvRenderInterface	{ class IRenderer; }
class ILogger;
//includes
#include <GL/glew.h>
#include <GL/glfw.h>

/**
 * RenderingDevice
 */
class RenderingDevice
{
	public:

		virtual ~RenderingDevice();
		static RenderingDevice * getInstance();

		/**
		 * Sets the logger for device
		 * Note: Ownership (and the responsibility of destroying the logger) is NOT given to this class
		 * @param logger	Logger to use
		 */
		void setLogger( ILogger * logger ) { m_logger = logger; }

		void shutdown();

		/**
		 *	Opens window and initializes the render into it.
		 */
		bool OpenScreen( int width, int height );

		/**
		 *	Returns the initialized singleton renderer instance.
		 *	May return null, if rendering context is not created yet.
		 */
		cvRenderInterface::IRenderer * getRenderer();


		/**
		 *	Show rendering results. */
		void flip();


	private:
		RenderingDevice();

		static RenderingDevice * m_device;
		cvRenderInterface::IRenderer * m_renderer;
		static bool m_isInitialized;
		ILogger * m_logger;
};

#endif // CVRENDERINGDEVICE_H_INCLUDED
